How to get started with unreal engine 4 c++ is not simple, even if you are a experienced programmer as some say..
Unreal Engine 4 API can be challenging.. expecially if you are starting to program or have never coded before so I will try to help you out keep in mind some stuff will be different, based on the version you have of the engine First
time I started playing around with Unreal Engine 4, I only had expirence with Unity 3D and it was not much, has not been even 1 year since I started game development, when I decided to move to Unreal
I was trully confused by the interface as it was rich compared to Unity(not a bad thing by the way.. i like minimalism) and sir. I have to tell you.better lookout for courses or tutorials on the internet, I've tried to learn
alone What a bad choise lol.. I could not do any, wasn't able to even create a blueprint of a door, as simple as I later discovered. Well.. enough let's get to the point Creating classes in unreal can be a pain, why? because must
of the time when you create a class using the hot reload, it will probably show you some errors
Most of them being caused by you creating a class, and not checking the code you previously editted or a simple hot reload bug, that usually is fixed by restarting the engine
a classic exemple is when you add a class before checking you code or building it as you don't know if there is any error yet. So this can make a russle to find it, because sometimes the engine won't tell you what happened
wrong with the code on the hotreload
What that means.. not much but the UHT(Unreal Heater Tool) need this to allow the engine to compile your code and show on the engine with blueprints if you're going to use them
// header
#include "NameOfYouClass.generated.h "
It's not so difficult but you can be easily overthinking when this error appear be sure to always check if the .generate.h is right on the header of your class
When using unreal for the first time, you need to learn UObjects an it's use inside the Engine A UObject it's the main class to create other classes inside the engine, that have a hell of children, One of them the most used it's AActor You will basiclly use for anything, even characters, why? because characters is a class derived from the AActor class What about controllers? Well... controllers are derived from AActors class too The only thing I know that is not derived directly from AActor it's UUserWidget class, as it derives from the Slate system of Unreal And the slate derives from UObject. So this won't have the same overridable functions and stuff, which is another thing you have to look for when using the overriden function, Always look's in the derived class which function this class allows to be overriden How I Do it? Quite simple.. Select the name of the class inside the header file and press f12 this will take you to the parent of that class
//header
// Your copyright notice
#pragma once
#include "CoreMinimal.h "
#include "GameFramework/Actor.h "
#include "YourClass.generated.h "
UCLASS() ↓ ¬ The class you should select and press f12 to go to the declaration
class YOURGAME_API AYourClass : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AYourClass();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
virtual void OnConstruction(const FTransform& Transform) override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};